#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;

//////////////////////////////////////////////////////
// DON'T FORGET TO SET THE NUMBER OF CHANNELS TO 4  //
// AND TO ENABLE THE EXTENDED NOTE RANGE            //
// IN FILE ARDUINO/LIBRARIES/GAMEBUINO/SETTINGS.C : //
// NUM_CHANNEL 4                                    //
// EXTENDED_NOTE_RANGE 1                            //
//////////////////////////////////////////////////////

//patterns					
/*	p00	*/	const unsigned int p00[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p01	*/	const unsigned int p01[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p02	*/	const unsigned int p02[] PROGMEM = {	0x40C,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p03	*/	const unsigned int p03[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p04	*/	const unsigned int p04[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x40C,0x4FC,0x418,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p05	*/	const unsigned int p05[] PROGMEM = {	0x4E4,0x4FC,0x408,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x408,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x0000	};
/*	p06	*/	const unsigned int p06[] PROGMEM = {	0x4E4,0x4FC,0x408,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x40C,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x4E4,0x4E4,0x0000	};
/*	p07	*/	const unsigned int p07[] PROGMEM = {	0x4E4,0x4FC,0x408,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x40C,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x0000	};
/*	p08	*/	const unsigned int p08[] PROGMEM = {	0x4E4,0x4FC,0x40C,0x4FC,0x4E4,0x4FC,0x4E4,0x4FC,0x408,0x4FC,0x4E4,0x4E4,0x4E4,0x4FC,0x4E4,0x4E4,0x0000	};
/*	p09	*/	const unsigned int p09[] PROGMEM = {	0	};
/*	p0A	*/	const unsigned int p0A[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p0B	*/	const unsigned int p0B[] PROGMEM = {	0	};
/*	p0C	*/	const unsigned int p0C[] PROGMEM = {	0x438,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x438,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p0D	*/	const unsigned int p0D[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p0E	*/	const unsigned int p0E[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p0F	*/	const unsigned int p0F[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p10	*/	const unsigned int p10[] PROGMEM = {	0x40C,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p11	*/	const unsigned int p11[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x418,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p12	*/	const unsigned int p12[] PROGMEM = {	0	};
/*	p13	*/	const unsigned int p13[] PROGMEM = {	0	};
/*	p14	*/	const unsigned int p14[] PROGMEM = {	0	};
/*	p15	*/	const unsigned int p15[] PROGMEM = {	0x428,0x4FC,0x42C,0x4FC,0x4FC,0x4FC,0x434,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p16	*/	const unsigned int p16[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x414,0x4FC,0x418,0x4FC,0x448,0x4FC,0x418,0x4FC,0x448,0x4FC,0x0000	};
/*	p17	*/	const unsigned int p17[] PROGMEM = {	0x4E4,0x4FC,0x40C,0x4FC,0x4E4,0x414,0x4E4,0x414,0x418,0x4FC,0x4E4,0x418,0x4E4,0x4E4,0x418,0x4E4,0x0000	};
/*	p18	*/	const unsigned int p18[] PROGMEM = {	0x408,0x408,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x0000	};
/*	p19	*/	const unsigned int p19[] PROGMEM = {	0	};
/*	p1A	*/	const unsigned int p1A[] PROGMEM = {	0x4E4,0x4FC,0x438,0x4E4,0x4FC,0x408,0x4E4,0x408,0x438,0x4FC,0x4E4,0x408,0x4E4,0x4FC,0x4E4,0x4FC,0x0000	};
/*	p1B	*/	const unsigned int p1B[] PROGMEM = {	0	};
/*	p1C	*/	const unsigned int p1C[] PROGMEM = {	0	};
/*	p1D	*/	const unsigned int p1D[] PROGMEM = {	0	};
/*	p1E	*/	const unsigned int p1E[] PROGMEM = {	0	};
/*	p1F	*/	const unsigned int p1F[] PROGMEM = {	0	};
/*	p20	*/	const unsigned int p20[] PROGMEM = {	0	};
/*	p21	*/	const unsigned int p21[] PROGMEM = {	0	};
/*	p22	*/	const unsigned int p22[] PROGMEM = {	0	};
/*	p23	*/	const unsigned int p23[] PROGMEM = {	0x4E4,0x4FC,0x438,0x4E4,0x4FC,0x408,0x4E4,0x40C,0x43C,0x4FC,0x4E4,0x40C,0x4E4,0x4FC,0x4E4,0x4E4,0x0000	};
/*	p24	*/	const unsigned int p24[] PROGMEM = {	0x4E4,0x4FC,0x43C,0x4E4,0x4FC,0x40C,0x4E4,0x408,0x438,0x4FC,0x4E4,0x408,0x4E4,0x4E4,0x4FC,0x4E4,0x0000	};
/*	p25	*/	const unsigned int p25[] PROGMEM = {	0x4E4,0x4FC,0x43C,0x4E4,0x4FC,0x414,0x4E4,0x414,0x418,0x448,0x4E4,0x478,0x4E4,0x4A8,0x4E4,0x4E4,0x0000	};
/*	p26	*/	const unsigned int p26[] PROGMEM = {	0	};
/*	p27	*/	const unsigned int p27[] PROGMEM = {	0	};
/*	p28	*/	const unsigned int p28[] PROGMEM = {	0x4E4,0x4FC,0x43C,0x4E4,0x4FC,0x414,0x4E4,0x414,0x418,0x448,0x4E4,0x4D4,0x4E4,0x4A8,0x4E4,0x4E4,0x0000	};
/*	p29	*/	const unsigned int p29[] PROGMEM = {	0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p2A	*/	const unsigned int p2A[] PROGMEM = {	0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p2B	*/	const unsigned int p2B[] PROGMEM = {	0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p2C	*/	const unsigned int p2C[] PROGMEM = {	0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x438,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p2D	*/	const unsigned int p2D[] PROGMEM = {	0x4FC,0x4FC,0x408,0x408,0x4FC,0x4FC,0x408,0x4FC,0x408,0x408,0x4FC,0x4FC,0x4FC,0x408,0x408,0x4FC,0x0000	};
/*	p2E	*/	const unsigned int p2E[] PROGMEM = {	0	};
/*	p2F	*/	const unsigned int p2F[] PROGMEM = {	0	};
/*	p30	*/	const unsigned int p30[] PROGMEM = {	0	};
/*	p31	*/	const unsigned int p31[] PROGMEM = {	0	};
/*	p32	*/	const unsigned int p32[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x414,0x4FC,0x418,0x4FC,0x4FC,0x4FC,0x4E4,0x4FC,0x4E4,0x4E4,0x0000	};
/*	p33	*/	const unsigned int p33[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x414,0x4FC,0x418,0x4FC,0x4FC,0x4FC,0x4E4,0x4FC,0x4E4,0x4E4,0x0000	};
/*	p34	*/	const unsigned int p34[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p35	*/	const unsigned int p35[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p36	*/	const unsigned int p36[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p37	*/	const unsigned int p37[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p38	*/	const unsigned int p38[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p39	*/	const unsigned int p39[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p3A	*/	const unsigned int p3A[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p3B	*/	const unsigned int p3B[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p3C	*/	const unsigned int p3C[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p3D	*/	const unsigned int p3D[] PROGMEM = {	0	};
/*	p3E	*/	const unsigned int p3E[] PROGMEM = {	0	};
/*	p3F	*/	const unsigned int p3F[] PROGMEM = {	0	};
/*	p40	*/	const unsigned int p40[] PROGMEM = {	0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x408,0x4FC,0x408,0x4FC,0x408,0x408,0x408,0x4FC,0x408,0x4FC,0x0000	};
/*	p41	*/	const unsigned int p41[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4A8,0x0000	};
/*	p42	*/	const unsigned int p42[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4A8,0x0000	};
/*	p43	*/	const unsigned int p43[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4A8,0x0000	};
/*	p44	*/	const unsigned int p44[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4A8,0x0000	};
/*	p45	*/	const unsigned int p45[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p46	*/	const unsigned int p46[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p47	*/	const unsigned int p47[] PROGMEM = {	0	};
/*	p48	*/	const unsigned int p48[] PROGMEM = {	0	};
/*	p49	*/	const unsigned int p49[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p4A	*/	const unsigned int p4A[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p4B	*/	const unsigned int p4B[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p4C	*/	const unsigned int p4C[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p4D	*/	const unsigned int p4D[] PROGMEM = {	0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p4E	*/	const unsigned int p4E[] PROGMEM = {	0	};
/*	p4F	*/	const unsigned int p4F[] PROGMEM = {	0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x408,0x4FC,0x408,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p50	*/	const unsigned int p50[] PROGMEM = {	0	};
/*	p51	*/	const unsigned int p51[] PROGMEM = {	0	};
/*	p52	*/	const unsigned int p52[] PROGMEM = {	0	};
/*	p53	*/	const unsigned int p53[] PROGMEM = {	0	};
/*	p54	*/	const unsigned int p54[] PROGMEM = {	0	};
/*	p55	*/	const unsigned int p55[] PROGMEM = {	0x408,0x4FC,0x40C,0x4FC,0x4FC,0x4FC,0x414,0x4FC,0x418,0x4FC,0x4FC,0x4FC,0x4E4,0x4FC,0x4E4,0x4E4,0x0000	};
/*	p56	*/	const unsigned int p56[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x468,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p57	*/	const unsigned int p57[] PROGMEM = {	0	};
/*	p58	*/	const unsigned int p58[] PROGMEM = {	0	};
/*	p59	*/	const unsigned int p59[] PROGMEM = {	0	};
/*	p5A	*/	const unsigned int p5A[] PROGMEM = {	0	};
/*	p5B	*/	const unsigned int p5B[] PROGMEM = {	0	};
/*	p5C	*/	const unsigned int p5C[] PROGMEM = {	0	};
/*	p5D	*/	const unsigned int p5D[] PROGMEM = {	0	};
/*	p5E	*/	const unsigned int p5E[] PROGMEM = {	0	};
/*	p5F	*/	const unsigned int p5F[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p60	*/	const unsigned int p60[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p61	*/	const unsigned int p61[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p62	*/	const unsigned int p62[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p63	*/	const unsigned int p63[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p64	*/	const unsigned int p64[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p65	*/	const unsigned int p65[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p66	*/	const unsigned int p66[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
/*	p67	*/	const unsigned int p67[] PROGMEM = {	0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x4FC,0x0000	};
					
//pattern set					
const uint16_t* const patternSet[] PROGMEM = {p00,p01,p02,p03,p04,p05,p06,p07,p08,p09,p0A,p0B,p0C,p0D,p0E,p0F,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p1A,p1B,p1C,p1D,p1E,p1F,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p2A,p2B,p2C,p2D,p2E,p2F,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p3A,p3B,p3C,p3D,p3E,p3F,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p4A,p4B,p4C,p4D,p4E,p4F,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p5A,p5B,p5C,p5D,p5E,p5F,p60,p61,p62,p63,p64,p65,p66,p67};					
					
//tracks					
const unsigned int track1[] PROGMEM = {0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x02D,0x038,0x02D,0x038,0x02D,0x038,0x02D,0x034,0x037,0x044,0x037,0x044,0x060,0x064,0x065,0x066,0x061,0x063,0x062,0x018,0x060,0x064,0x065,0x066,0x060,0x064,0x065,0x066,0x060,0x064,0x065,0x066,0x067,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0xFFFF};					
const unsigned int track2[] PROGMEM = {0x04F,0x055,0x04F,0x055,0x000,0x001,0x002,0x003,0x000,0x001,0x002,0x003,0x000,0x001,0x002,0x032,0x005,0x006,0x007,0x008,0x005,0x006,0x007,0x017,0x01A,0x023,0x023,0x024,0x01A,0x023,0x033,0x025,0x01A,0x023,0x023,0x024,0x01A,0x023,0x023,0x028,0x04D,0x05F,0x04D,0x05F,0x04D,0x05F,0x04D,0x05F,0x04D,0x05F,0x04D,0x05F,0x04D,0x05F,0x04D,0x05F,0xFFFF};					
const unsigned int track3[] PROGMEM = {0x05F,0x05F,0x05F,0x056,0x1300,0x1301,0x1302,0x1303,0x1300,0x1301,0x1302,0x1303,0x1300,0x1301,0x1302,0x1303,0x1300,0x1301,0x1302,0x1303,0x1300,0x1301,0x1302,0x1303,0x1336,0x1336,0x1436,0x1636,0x1C36,0x1F36,0x2236,0x2336,0x1329,0x132A,0x132B,0x182C,0x1329,0x1349,0x134A,0x184B,0xE84C,0x1135,0x1035,0x1135,0x1035,0x1135,0x1035,0x1135,0x1035,0x1135,0x1035,0x1135,0x05F,0x05F,0x05F,0x05F,0xFFFF};					
const unsigned int track4[] PROGMEM = {0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x041,0x280E,0x280F,0x2810,0x2811,0x3045,0x3046,0x3010,0x3016,0x2839,0x283A,0x283B,0x283C,0x3039,0x303A,0x303B,0x3040,0x280E,0x280F,0x2810,0x2811,0x3045,0x3046,0x3010,0x3016,0xFC42,0xFD42,0xFA42,0xFA43,0xFD42,0x042,0x142,0x243,0x04C,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0x05F,0xFFFF};					

void setup(){
  gb.begin();
  gb.titleScreen(F("Music demo"));
  gb.frameCount = LCDWIDTH*8;
  gb.setFrameRate(30);
  gb.sound.changePatternSet(patternSet,0);
  gb.sound.changePatternSet(patternSet,1);
  gb.sound.changePatternSet(patternSet,2);
  gb.sound.changePatternSet(patternSet,3);
  gb.sound.playTrack(track2,0);
  gb.sound.playTrack(track1,1);
  gb.sound.playTrack(track3,2);
  gb.sound.playTrack(track4,3);
  gb.sound.command(CMD_INSTRUMENT, 1, 0, 3);
}

void loop(){
  if(gb.update()){
    //display some fancy stuff
    gb.display.cursorX = -gb.frameCount/4;
    gb.display.cursorY = 8;
    gb.display.print("Music: The Other Days - Code: Rodot");
    if(gb.sound.trackIsPlaying[0]){
      for(byte channel = 0; channel < NUM_CHANNELS; channel++){
        gb.display.drawRoundRect(9,15+channel*8,59+8,9,3);
        if(gb.sound.outputVolume[channel])
          gb.display.fillRoundRect(9+gb.sound.outputPitch[channel],15+channel*8,9,9,3);
      }
    }
    else {
      gb.display.cursorX = 30;
      gb.display.cursorY = 24;
      gb.display.print("THANKS\n\n");
      gb.display.cursorX = 12;
      gb.display.print("PRESS \27 TO EXIT");
    }
    
    if(gb.buttons.pressed(BTN_C)){
      gb.sound.stopTrack();
      gb.titleScreen(F("Music demo"));
      gb.sound.playTrack(track2,0);
      gb.sound.playTrack(track1,1);
      gb.sound.playTrack(track3,2);
      gb.sound.playTrack(track4,3);
    }
  }
}
